package com.wisely;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

@Controller
public class Demo {
    @RequestMapping("/")
    public String index(Model model){
        Person single = new Person("baobo",11);
        model.addAttribute("singlePerson",single);

        List<Person> peopleList = new ArrayList<Person>();
        Person p1 = new Person("张三",12);
        Person p2 = new Person("李四",24);
        Person p3 = new Person("王五",36);
        peopleList.add(p1);
        peopleList.add(p2);
        peopleList.add(p3);

        model.addAttribute("people",peopleList);
        return "index";
    }
}
